home *** CD-ROM | disk | FTP | other *** search
- property theSelectedSprNumber, baseRecordSprOffset, editType
- global scoreData, dispatchTable, currentFrame, soundFXData, soundLoopData, dirtyFlag, selectionHiliteSpr, foregroundFXSpr, backgroundFXSpr, theStageBounds
-
- on birth me
- set baseRecordSprOffset to 2
- return me
- end
-
- on hiliteSelectedClip me, whichSpr
- if whichSpr = backgroundFXSpr then
- set the rect of sprite selectionHiliteSpr to inflate(the rect of cast the castNum of sprite whichSpr, -20, -20)
- set the loc of sprite selectionHiliteSpr to point(the left of sprite whichSpr + 20, the top of sprite whichSpr + 20)
- else
- set the rect of sprite selectionHiliteSpr to inflate(the rect of cast the castNum of sprite whichSpr, 2, 2)
- set the loc of sprite selectionHiliteSpr to point(the left of sprite whichSpr - 2, the top of sprite whichSpr - 2)
- end if
- updateStage()
- end
-
- on selectClip me, whichSpr
- set theSelectedSprNumber to whichSpr
- set editType to #CLIP
- if (whichSpr = foregroundFXSpr) or (whichSpr = backgroundFXSpr) then
- showPalette(paletteMgr, #partialEdit)
- else
- showPalette(paletteMgr, #FullEdit)
- end if
- hiliteSelectedClip(me, whichSpr)
- end
-
- on moveClip me, whichSpr
- set theSelectedSprNumber to whichSpr
- set offsetH to the mouseH - the locH of sprite theSelectedSprNumber
- set offsetV to the mouseV - the locV of sprite theSelectedSprNumber
- repeat while the mouseDown
- set theMouseLoc to point(the mouseH, the mouseV)
- if inside(theMouseLoc, theStageBounds) then
- set theMouseH to the mouseH
- set theMouseV to the mouseV
- set the loc of sprite theSelectedSprNumber to point(theMouseH - offsetH, theMouseV - offsetV)
- end if
- updateStage()
- end repeat
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theChannelNumber to getAt(getAt(dispatchTable, theSlotNumber), 3)
- set referenceClip to getAt(getAt(scoreData, currentFrame), theChannelNumber)
- setAt(referenceClip, 2, the locH of sprite theSelectedSprNumber)
- setAt(referenceClip, 3, the locV of sprite theSelectedSprNumber)
- setAt(getAt(scoreData, currentFrame), theChannelNumber, referenceClip)
- set dirtyFlag to 1
- end
-
- on confirmBurnScene me
- set numberOfFrames to count(scoreData)
- if numberOfFrames > 0 then
- set numberOfFramesToDelete to numberOfFrames - currentFrame + 1
- if currentFrame = numberOfFrames then
- if currentFrame = 1 then
- set theMessage to "Are you sure you want to delete all the frames in this animation?"
- else
- set theMessage to "Are you sure you want to delete the last frame in this animation?"
- end if
- else
- if numberOfFramesToDelete < numberOfFrames then
- set theMessage to "Are you sure you want to delete all the animation from frame " & currentFrame & " to frame " & numberOfFrames & "?"
- else
- set theMessage to "Are you sure you want to delete all the frames in this animation?"
- end if
- end if
- set theAlertBoxType to #cancel_ok
- showTheAlertBox(theMessage, theAlertBoxType, "nothing", "nothing", "burnScene(editMgr)")
- else
- set theMessage to "Hey man there ain't no frames to delete. Make some first okay?"
- set theAlertBoxType to #OK
- showTheAlertBox(theMessage, theAlertBoxType, "nothing", "nothing", "nothing")
- end if
- end
-
- on burnScene me
- set numberOfFrames to count(scoreData)
- set numberOfFramesToDelete to numberOfFrames - currentFrame + 1
- if numberOfFramesToDelete < numberOfFrames then
- removeFrames(listMgr, numberOfFramesToDelete)
- decrementFrame()
- if currentFrame < 1 then
- resetFrameCounter()
- end if
- setKrusty(playbackMgr)
- showFrame(playbackMgr, currentFrame, 0)
- updateDispatchTable(layerMgr)
- set dirtyFlag to 1
- else
- reset(appMgr)
- end if
- end
-
- on holdClip me, direction
- if editType = #CLIP then
- if direction = 1 then
- holdClipForward(me)
- else
- if direction = -1 then
- holdClipBackward(me)
- else
- holdClipForward(me)
- holdClipBackward(me)
- end if
- end if
- else
- if direction = 1 then
- holdSoundForward(me)
- else
- if direction = -1 then
- holdSoundBackward(me)
- else
- holdSoundForward(me)
- holdSoundBackward(me)
- end if
- end if
- end if
- set dirtyFlag to 1
- end
-
- on holdClipForward me
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theSlot to getAt(dispatchTable, theSlotNumber)
- set theChannelNumber to getAt(theSlot, 3)
- set theType to getAt(theSlot, 1)
- if theType = "P" then
- set theSearchField to getAt(theSlot, 4)
- set theLineCount to the number of lines in field theSearchField
- set theSearchString to string(getAt(theSlot, 2))
- repeat with theLineNumber = 1 to theLineCount
- if value(item 2 of line theLineNumber of field theSearchField) = theSearchString then
- set thePropClipRecord to value(line theLineNumber of field theSearchField)
- exit repeat
- end if
- end repeat
- if not voidp(thePropClipRecord) then
- set theLoopList to getAt(thePropClipRecord, 5)
- set theLoopCount to count(theLoopList)
- set theLoopNumber to 1
- set referenceClip to getAt(getAt(scoreData, currentFrame), theChannelNumber)
- repeat with theFrameNumber = currentFrame + 1 to count(scoreData)
- set newReferenceClip to copyList(referenceClip)
- setAt(newReferenceClip, 1, getAt(theLoopList, theLoopNumber))
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, newReferenceClip)
- if theLoopNumber < theLoopCount then
- set theLoopNumber to theLoopNumber + 1
- next repeat
- end if
- set theLoopNumber to 1
- end repeat
- end if
- else
- set referenceClip to getAt(getAt(scoreData, currentFrame), theChannelNumber)
- repeat with theFrameNumber = currentFrame + 1 to count(scoreData)
- set newReferenceClip to copyList(referenceClip)
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, newReferenceClip)
- end repeat
- end if
- end
-
- on holdClipBackward me
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theSlot to getAt(dispatchTable, theSlotNumber)
- set theChannelNumber to getAt(theSlot, 3)
- set theType to getAt(theSlot, 1)
- if theType = "P" then
- set theSearchField to getAt(theSlot, 4)
- set theLineCount to the number of lines in field theSearchField
- set theSearchString to string(getAt(theSlot, 2))
- repeat with theLineNumber = 1 to theLineCount
- if value(item 2 of line theLineNumber of field theSearchField) = theSearchString then
- set thePropClipRecord to value(line theLineNumber of field theSearchField)
- exit repeat
- end if
- end repeat
- if not voidp(thePropClipRecord) then
- set theLoopList to getAt(thePropClipRecord, 5)
- set theLoopCount to count(theLoopList)
- set theLoopNumber to 1
- set referenceClip to copyList(getAt(getAt(scoreData, currentFrame), theChannelNumber))
- repeat with theFrameNumber = 1 to currentFrame - 1
- set newReferenceClip to copyList(referenceClip)
- setAt(newReferenceClip, 1, getAt(theLoopList, theLoopNumber))
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, newReferenceClip)
- if theLoopNumber < theLoopCount then
- set theLoopNumber to theLoopNumber + 1
- next repeat
- end if
- set theLoopNumber to 1
- end repeat
- end if
- else
- set referenceClip to copyList(getAt(getAt(scoreData, currentFrame), theChannelNumber))
- repeat with theFrameNumber = 1 to currentFrame - 1
- set newReferenceClip to copyList(referenceClip)
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, newReferenceClip)
- end repeat
- end if
- end
-
- on deleteClip me, direction
- if editType = #CLIP then
- if direction = 1 then
- deleteClipForward(me)
- else
- if direction = -1 then
- deleteClipBackward(me)
- else
- if theSelectedSprNumber = 2 then
- deleteBackgroundFX(me)
- else
- if theSelectedSprNumber = 16 then
- deleteForegroundFX(me)
- else
- deleteClipThroughOut(me)
- end if
- end if
- end if
- end if
- showFrame(playbackMgr, currentFrame, 0)
- else
- if direction = 1 then
- deleteSoundForward(me)
- deleteSoundFromCurrentFrame(me)
- else
- if direction = -1 then
- deleteSoundBackward(me)
- deleteSoundFromCurrentFrame(me)
- else
- deleteSoundForward(me)
- deleteSoundBackward(me)
- deleteSoundFromCurrentFrame(me)
- end if
- end if
- hideFieldHiliterSpr(appMgr)
- if editType = #snd then
- put EMPTY into field "soundStatusField"
- else
- put EMPTY into field "loopStatusField"
- end if
- end if
- set dirtyFlag to 1
- end
-
- on deleteClipForward me
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theChannelNumber to getAt(getAt(dispatchTable, theSlotNumber), 3)
- set totalFrames to count(scoreData)
- purgeClips(me, currentFrame, totalFrames, theChannelNumber)
- repeat with theFrameNumber = currentFrame to totalFrames
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, [])
- end repeat
- checkForLeftOvers(me, theChannelNumber, theSlotNumber)
- end
-
- on deletePropPart me, theChannelNumber
- set theSlotNumber to 1
- set foundSlot to 0
- repeat with theSlot in dispatchTable
- if getAt(theSlot, 3) = theChannelNumber then
- set foundSlot to 1
- exit repeat
- end if
- set theSlotNumber to theSlotNumber + 1
- end repeat
- set totalFrames to count(scoreData)
- purgeClips(me, currentFrame, totalFrames, theChannelNumber)
- repeat with theFrameNumber = currentFrame to totalFrames
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, [])
- end repeat
- if foundSlot then
- checkForLeftOvers(me, theChannelNumber, theSlotNumber)
- end if
- end
-
- on deleteClipBackward me
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theChannelNumber to getAt(getAt(dispatchTable, theSlotNumber), 3)
- purgeClips(me, 1, currentFrame, theChannelNumber)
- repeat with theFrameNumber = 1 to currentFrame
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, [])
- end repeat
- checkForLeftOvers(me, theChannelNumber, theSlotNumber)
- end
-
- on checkForLeftOvers me, theChannelNumber, theSlotNumber
- set isTotallyErased to 1
- repeat with theFrame = 1 to count(scoreData)
- if getAt(getAt(scoreData, theFrame), theChannelNumber) <> EMPTY then
- set isTotallyErased to 0
- exit repeat
- end if
- end repeat
- if isTotallyErased then
- deleteAt(dispatchTable, theSlotNumber)
- updateDispatchTable(layerMgr)
- end if
- end
-
- on deleteClipThroughOut me
- set theSlotNumber to theSelectedSprNumber - baseRecordSprOffset
- set theChannelNumber to getAt(getAt(dispatchTable, theSlotNumber), 3)
- set totalFrames to count(scoreData)
- purgeClips(me, 1, totalFrames, theChannelNumber)
- repeat with theFrameNumber = 1 to totalFrames
- setAt(getAt(scoreData, theFrameNumber), theChannelNumber, [])
- end repeat
- deleteAt(dispatchTable, theSlotNumber)
- updateDispatchTable(layerMgr)
- end
-
- on purgeClips me, startFrame, endFrame, theChannelNumber
- set purgeList to []
- repeat with theFrameNumber = startFrame to endFrame
- set curclip to getAt(getAt(scoreData, theFrameNumber), theChannelNumber)
- if curclip <> EMPTY then
- append(purgeList, getAt(curclip, 1))
- end if
- end repeat
- set thePreviousCastNumber to 0
- sort(purgeList)
- repeat with theCastNumber in purgeList
- if theCastNumber <> thePreviousCastNumber then
- unLoadCast(theCastNumber)
- set thePreviousCastNumber to theCastNumber
- end if
- end repeat
- end
-
- on deleteForegroundFX me
- set countFgdFXData to count(fgdFXData)
- set countScoreData to count(scoreData)
- if countFgdFXData < countScoreData then
- repeat with theFrameNumber = countFgdFXData + 1 to countScoreData
- append(fgdFXData, copyList([]))
- end repeat
- end if
- set fgdFXFrame to getAt(fgdFXData, currentFrame)
- set fgdFXName to getAt(fgdFXFrame, 4)
- repeat with theFrameNum = currentFrame to countScoreData
- set theFrameRecord to getAt(fgdFXData, theFrameNum)
- if theFrameRecord <> EMPTY then
- if fgdFXName = getAt(theFrameRecord, 4) then
- unLoadCast(getAt(theFrameRecord, 1))
- setAt(fgdFXData, theFrameNum, copyList([]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- repeat with theFrameNum = currentFrame - 1 down to 1
- set theFrameRecord to getAt(fgdFXData, theFrameNum)
- if theFrameRecord <> EMPTY then
- if fgdFXName = getAt(theFrameRecord, 4) then
- unLoadCast(getAt(theFrameRecord, 1))
- setAt(fgdFXData, theFrameNum, copyList([]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- end
-
- on deleteBackgroundFX me
- set countBgdFXData to count(bgdFXData)
- set countScoreData to count(scoreData)
- if countBgdFXData < countScoreData then
- repeat with theFrameNumber = countBgdFXData + 1 to countScoreData
- append(bgdFXData, copyList([EMPTY, 0]))
- end repeat
- end if
- set bgdFXFrame to getAt(bgdFXData, currentFrame)
- set bgdFXName to getAt(bgdFXFrame, 1)
- repeat with theFrameNum = currentFrame to countScoreData
- set theFrameRecord to getAt(bgdFXData, theFrameNum)
- if theFrameRecord <> EMPTY then
- if bgdFXName = getAt(theFrameRecord, 1) then
- unLoadCast(getAt(theFrameRecord, 2))
- setAt(bgdFXData, theFrameNum, copyList([EMPTY, 0]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- repeat with theFrameNum = currentFrame - 1 down to 1
- set theFrameRecord to getAt(bgdFXData, theFrameNum)
- if theFrameRecord <> EMPTY then
- if bgdFXName = getAt(theFrameRecord, 1) then
- unLoadCast(getAt(theFrameRecord, 2))
- setAt(bgdFXData, theFrameNum, copyList([EMPTY, 0]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- end
-
- on editSoundFx me
- if the text of field "soundStatusField" <> EMPTY then
- set editType to #snd
- hiliteSoundFXField(appMgr)
- showPalette(paletteMgr, #partialEdit)
- end if
- end
-
- on editSoundLoop me
- if the text of field "loopStatusField" <> EMPTY then
- set editType to #LOO
- hiliteSoundLoopField(appMgr)
- showPalette(paletteMgr, #FullEdit)
- end if
- end
-
- on deleteSoundForward me
- if editType = #snd then
- set theDataList to soundFXData
- else
- set theDataList to soundLoopData
- end if
- if count(theDataList) < count(scoreData) then
- set lastSoundLoop to getLast(theDataList)
- repeat with theFrameNumber = count(theDataList) + 1 to count(scoreData)
- append(theDataList, copyList(lastSoundLoop))
- end repeat
- end if
- set theSound to getAt(theDataList, currentFrame)
- set theSoundCastNum to getAt(theSound, 2)
- repeat with theFrameNum = currentFrame + 1 to count(scoreData)
- set theFrameRecord to getAt(theDataList, theFrameNum)
- if theFrameRecord <> EMPTY then
- if theSoundCastNum = getAt(theFrameRecord, 2) then
- setAt(theDataList, theFrameNum, copyList([EMPTY, 0]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- end
-
- on deleteSoundBackward me
- if editType = #snd then
- set theDataList to soundFXData
- else
- set theDataList to soundLoopData
- end if
- if count(theDataList) < count(scoreData) then
- set lastSoundLoop to getLast(theDataList)
- repeat with theFrameNumber = count(theDataList) + 1 to count(scoreData)
- append(theDataList, copyList(lastSoundLoop))
- end repeat
- end if
- set theSound to getAt(theDataList, currentFrame)
- set theSoundCastNum to getAt(theSound, 2)
- repeat with theFrameNum = currentFrame - 1 down to 1
- set theFrameRecord to getAt(theDataList, theFrameNum)
- if theFrameRecord <> EMPTY then
- if theSoundCastNum = getAt(theFrameRecord, 2) then
- setAt(theDataList, theFrameNum, copyList([EMPTY, 0]))
- else
- exit repeat
- end if
- next repeat
- end if
- exit repeat
- end repeat
- end
-
- on deleteSoundFromCurrentFrame me
- if editType = #snd then
- set theDataList to soundFXData
- else
- set theDataList to soundLoopData
- end if
- if count(theDataList) < count(scoreData) then
- repeat with theFrameNumber = count(theDataList) + 1 to count(scoreData)
- append(theDataList, copyList([EMPTY, 0]))
- end repeat
- end if
- unLoadCast(getAt(getAt(theDataList, currentFrame), 2))
- setAt(theDataList, currentFrame, copyList([EMPTY, 0]))
- end
-
- on holdSoundForward me
- set countScoreData to count(scoreData)
- set countSoundLoopData to count(soundLoopData)
- set theReferenceFrame to getLast(soundLoopData)
- if countSoundLoopData < countScoreData then
- repeat with theFrameNumber = countSoundLoopData + 1 to countScoreData
- append(soundLoopData, copyList(theReferenceFrame))
- end repeat
- end if
- set theSound to getAt(soundLoopData, currentFrame)
- repeat with theFrameNum = currentFrame to countScoreData
- setAt(soundLoopData, theFrameNum, copyList(theSound))
- end repeat
- put getAt(theSound, 1) into field "loopStatusField"
- end
-
- on holdSoundBackward me
- set countScoreData to count(scoreData)
- set countSoundLoopData to count(soundLoopData)
- set theReferenceFrame to getLast(soundLoopData)
- if countSoundLoopData < countScoreData then
- repeat with theFrameNumber = countSoundLoopData + 1 to countScoreData
- append(soundLoopData, copyList(theReferenceFrame))
- end repeat
- end if
- set theSound to getAt(soundLoopData, currentFrame)
- repeat with theFrameNum = currentFrame - 1 down to 1
- setAt(soundLoopData, theFrameNum, copyList(theSound))
- end repeat
- put getAt(theSound, 1) into field "loopStatusField"
- end
-